import java.awt.event.MouseEvent;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import javax.swing.JOptionPane;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import clojure.lang.RT;
import clojure.lang.Var;

public class TwitterButtonAddUserController extends TwitterButtonController {

	public TwitterButtonAddUserController(String defaultImagePath,
			String rolloverImagePath) {
		super(defaultImagePath, rolloverImagePath);
		try {
			RT.loadResourceScript("GetUser.clj");
		} catch (IOException e1) {
			e1.printStackTrace();
		}
		Var report = RT.var("clj.script.examples", "mouseClicked");
		report.invoke(this);
	}
	
	public static void getUser(final String userName) {
		try {
			Twitter twitter = new TwitterFactory().getInstance();
			twitter.showUser(userName);
			TweetPanelView.twitterUser.add(new TwitterUserModel(userName));
			TweetPanelView.twitterUser.get(
					TweetPanelView.twitterUser.size() - 1).setTweetTime();
			try {
				TweetPanelModel.updateTweets();
			} catch (ExecutionException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} catch (TwitterException | InterruptedException te) {
		}
	}

}
